<?php


namespace App\Service;

use JPush\Client as JP;
class Jpush
{
    public $appkey = '731190235fc33a2a2b6fa3b0';
    public $appsec = '948832c573bc0f3652762b0e';


    public function push(){
        $client = new JP($this->appkey, $this->appsec);
        $pusher = $client->push();
        $pusher->setPlatform('all');
        $pusher->addAllAudience();
        $pusher->setNotificationAlert('您有新的订单');
        try {
            $pusher->send();
        } catch (\JPush\Exceptions\JPushException $e) {
            // try something else here
            print $e;
        }
    }
}